﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITSP.SharePoint.CacheRefresh.Examples
{
    /// <summary>
    /// Cache Manager for storing the SharePrice.
    /// </summary>
    public class SharePriceCacheManager : BaseCacheConfigurationManager
    {

        private const string CONST_ListCacheKey = "Example";
        private const string CONST_CacheKey = "ITSP_SharePrice_CacheKey";
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="cacheHostUrl"></param>
        public SharePriceCacheManager(string cacheHostUrl)
            :base(cacheHostUrl, CONST_ListCacheKey,CONST_CacheKey)
        {
            
            
        }

        /// <summary>
        /// Load function gets the object from the IIS cache
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="cacheKey"></param>
        /// <returns></returns>
        public override T Load<T>(string cacheKey)
        {
            return GetFromCache<T>(cacheKey);
        }

        /// <summary>
        /// Save function saves to the IIS Cache.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="configuration"></param>
        /// <param name="cacheKey"></param>
        /// <returns></returns>
        public override bool Save<T>(T configuration, string cacheKey)
        {
            return AddToCache(configuration, cacheKey);
        }
    }
}
